;;;Place silt fence linear symbol as an anonymous block.
;;;
;;;	Author:
;;;		Henry C. Francis
;;;		425 N. Ashe St.
;;;		Southern Pines, NC 28387
;;;
;;;	http://www.paracadd.com/
;;;	All rights reserved.
;;;
(DEFUN C:SILTFEN ( )
(setq osmod (getvar"osmode"))
(setvar "osmode" 0)
  (setq begin "T")
  (IF dimscl nil (LOAD "dimscl" "\nFile DIMSCL.LSP not loaded! "))
  (if upoint nil (load"upoint" "\nFile UPOINT.LSP not loaded! "))
  (dimscl)
  (SETQ cirad (* dimsc 0.0625))
  (entmake
    (list
      (cons 0 "BLOCK")
      (cons 70 1)
      (cons 2 "*U")
      (cons 10 (list 0 0 0))
    )
  )
  (setq pt1 (upoint 0 "" "Fence beginning point" nil nil))
  (while
    (setq pt2 (upoint 0 "" "Next fence point" nil pt1))
    (setq fenl (distance pt1 pt2)
          count (1+(fix(/ fenl (* dimsc 0.5))))
          cispc (/ fenl count)
    );setq
    (while
      (> count 0)
    (setq langl (angle pt1 pt2)
          lang2 (+ langl (* pi 0.25))
          lang3 (+ langl (* pi 0.75))
          pt4 (polar pt1 langl (* cispc 0.5))
          pt4e (polar pt4 langl (* cispc 0.5))
          pt3 (polar pt4 langl (* dimsc 0.0625))
          pt5b (polar pt4 (+ langl pi) (* dimsc 0.0625))
          pt5 (polar pt4 langl (- cispc (* dimsc 0.0625)))
          pt6 (polar pt4 lang2 cirad)
          pt7 (polar pt4 (+ pi lang2) cirad)
          pt8 (polar pt4 lang3 cirad)
          pt9 (polar pt4 (+ pi lang3) cirad)
          pta1 (polar pt1 lang2 cirad)
          pta2 (polar pt1 (+ pi lang2) cirad)
          pta3 (polar pt1 lang3 cirad)
          pta4 (polar pt1 (+ pi lang3) cirad)
    );setq
    (if begin
      (progn
        (entmake
          (list
            (cons 0 "LINE")
            (cons 10 pt1)
            (cons 11 pt5b)
            (cons 8 "0")
          )
        )
        (grdraw pt1 pt5b 7)
        (setq begin nil)
      );progn
    );if
    (if (= count 1)
    (progn
      (entmake
        (list
          (cons 0 "LINE")
          (cons 10 pt3)
          (cons 11 pt4e)
          (cons 8 "0")
        )
      )
      (grdraw pt3 pt4e 7)
      (setq begin "T")
    );progn
    (progn
      (entmake
        (list
          (cons 0 "LINE")
          (cons 10 pt3)
          (cons 11 pt5)
          (cons 8 "0")
        )
      )
      (grdraw pt3 pt5 7)
    );progn
    );if
    (entmake
      (list
        (cons 0 "LINE")
        (cons 10 pt6)
        (cons 11 pt7)
        (cons 8 "0")
      )
    )
    (entmake
      (list
        (cons 0 "LINE")
        (cons 10 pt8)
        (cons 11 pt9)
        (cons 8 "0")
      )
    )
    (grdraw pt6 pt7 7)
    (grdraw pt8 pt9 7)
    (setq pt1 (polar pt4 langl (* cispc 0.5))
          count (1- count)
    );setq
    );while
  );while
(setq nblk (entmake (list (cons 0 "endblk"))))
(princ (strcat "\nBlock "(if nblk nblk "NOT")" Made\n"))
  (entmake
    (list
      (cons 0 "INSERT")
      (cons 2 nblk)
      (cons 10 (list 0 0 0))
      (cons 8 (getvar"clayer"))
      (cons 70 1)
    )
  )
  (setvar "osmode" osmod)
  (princ)
);defun